<?php echo $link->projectLink($project_id, $project_name, __('create_ticket', true), "/tickets/add"); ?>
<br />
<div id="filtre" class="largebloc2">
	<h3><?php echo __('filters'); ?></h3>
	<?php //echo $ajax->link(__('advanced_search', true), '/tickets/homeAvc', array('update'=>'filtre')); ?>
	<form action="filtre" method="get" accept-charset="utf-8">
		<?php echo $form->input('Ticket.id', array('label' => __('by_id', true).' : ', 'type' => 'text')); ?>
		<?php echo $form->input('Ticket.name', array('label' => __('by_keyword', true).' : ')); ?>
		<label></label>
		<?php echo $ajax->submit(__('filter', true), array('url' => 'filter/' . $project_id, 'update'=>'table_tickets', 'div' => false)); ?>
	</form>
</div>

<br />
<h2><?php __('tickets') ?></h2>
<div id="table_tickets" class="largebloc1">
<table width="100%" border="0" cellspacing="0" cellpadding="2" class="sortable">
	<?php 
	if ($allowDelete) {
		echo $html->tableHeaders(array('No', __('name', true), __('state', true), __('kind', true), __('owner', true), __('batch', true), __('modify_date', true), __('creation_date', true), 'Actions'), 'class="details"'); 
	} else {
		echo $html->tableHeaders(array('No', __('name', true), __('state', true), __('kind', true), __('owner', true), __('batch', true), __('modify_date', true), __('creation_date', true)), 'class="details"'); 		
	}
	foreach ($tickets as $ticket) {
			echo $html->tableCells(array($link->projectLink($project_id, $project_name, "#" . $ticket['Ticket']['id'], '/tickets/view/'. $ticket['Ticket']['id']),
									$link->projectLink($project_id, $project_name, $ticket['Ticket']['name'], '/tickets/view/'. $ticket['Ticket']['id']),
									$ticket['Ticket']['status'],
									$ticket['Ticket']['kind'],
									$ticket['User']['firstname'] . " " .$ticket['User']['lastname'],
									$link->projectLink($project_id, $project_name, $ticket['Batch']['name'], '/batches/view/'. $ticket['Batch']['id']),
									$time->niceShort($ticket['Ticket']['update_date']),
									$time->niceShort($ticket['Ticket']['creation_date']),
									$allowDelete ? $link->projectLink($project_id, $project_name, __('edit', true), '/tickets/view/'. $ticket['Ticket']['id']). ' '. $html->link(__('delete', true), '/'.$project_name.'/'.$project_id.'/tickets/delete/'.$ticket['Ticket']['id'].'/', NULL, 'Are you sure ?') : ' '),
								 'class="odd"', 'class="even"');
	}		
	?>
</table>
</div>